package com.antler.smt.portal.controller;

import com.antler.smt.portal.annotation.OperateCut;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.WishPeopleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 中意的工程师
 *
 * @author zhangyi
 * @date 2018/9/20 18:12
 */
@RestController
@RequestMapping("/wish")
@Api(description = "对钟意的工程师的操作")
public class WishPeopleController extends BaseController{

    @Resource
    private WishPeopleService wishPeopleService;

    /**
     * 添加中意的共享工程师列表
     *
     * @return
     */
    @PostMapping("/addPeopleList/{employed}")
    @OperateCut(operationContent = "添加中意的共享工程师列表")
    @ApiOperation(value = "添加中意的共享工程师列表", httpMethod = "POST")
    public Result addPeopleList(@PathVariable("employed") Long employed) {

        return wishPeopleService.addPeopleList(currentMember.getId(),employed);
    }


    /**
     * 查看中意的共享工程师列表
     *
     * @return
     */
    @GetMapping("/getPeopleList")
    @OperateCut(operationContent = "查看中意的共享工程师列表")
    @ApiOperation(value = "查看中意或者是不钟意的共享工程师列表", httpMethod = "GET")
    public Result getPeopleList() {

        return wishPeopleService.getPeopleList(currentMember.getId());
    }

    /**
     * 取消中意的共享工程师
     *
     * @return
     */
    @PutMapping("/cancelWishPeople/{peopleId}")
    @OperateCut(operationContent = "取消中意的共享工程师")
    @ApiOperation(value = "取消中意的共享工程师", httpMethod = "PUT")
    public Result cancelWishPeople(@PathVariable(value = "peopleId") Long peopleId) {

        return wishPeopleService.cancelWishPeople(peopleId);
    }
}
